home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_218 / edlib / hextoint.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  527b  |  24 lines

  1. /*
  2.  * edlib v1.1 Copyright 1989 Edwin Hoogerbeets
  3.  * This code is freely redistributable as long as no charge other than
  4.  * reasonable copying fees are levied for it.
  5.  */
  6.  
  7. /* this function takes a string of hex digits and returns its value */
  8. #include <ctype.h>
  9.  
  10. int hextoint(number)
  11. register char *number;
  12. {
  13.     register int value = 0;
  14.  
  15.     while ( *number )
  16.         if ( isxdigit(*number) ) {
  17.             value = ( value << 4 )  + toint(*number++);
  18.         } else {
  19.             return(value);
  20.         }
  21.  
  22.     return(value);
  23. }
  24.